#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: node09_add_delete_field.py 
@version:
@time: 2022/05/18 
"""
# 02
from TapClientCore.T04_logic.Dag02.node.operate_node.node08_field_rename import FieldRenameNode


class AddDeleteField(FieldRenameNode):
    """
    [
          {
            "op": "CREATE",
            "field": "newFieldName",
            "tableName": "",
            "java_type": "String",
            "id": "14bcb2ee-2070-45a8-8e24-686b5c2ed3e0",
            "action": "create_sibling",
            "triggerFieldId": "",
            "label": "newFieldName",
            "level": 1
          }
        ]
    """
    def generate_node(self, operations):
        node = {
            "id": self.newId,
            "name": "自动化-增删字段",
            "type": "field_add_del_processor",
            "attrs": {
                "position": [
                    -500,
                    200
                ]
            },
            "catalog": "processor",
            "deleteAllFields": False,
            "elementType": "Node",
            "processorThreadNum": 1,
            "operations": operations
        }
        self.node = node
